local function OnPlayerActivated(_, player)
    if not player:HasTag("strongman") then
        return
    end
    local Actions = GLOBAL.ACTIONS
    local PlayerController = player and player.components.playercontroller
    local PlayerActionPicker = player and player.components.playeractionpicker

    if not PlayerController or not PlayerActionPicker or not Actions then
        return
    end
    local p_acts = {Actions.ACTIVATE, Actions.PICKUP, Actions.MOUNT, Actions.DISMOUNT}

    local OldGetRightClickActions = PlayerActionPicker.GetRightClickActions
    function PlayerActionPicker:GetRightClickActions(pos, target, ...)
        local actions = OldGetRightClickActions(self, pos, target, ...)
        if #actions == 1 and target and actions[1].action == Actions.TOSS then
            local sact = self:GetSceneActions(target, true)
            if sact[1] and (table.contains(p_acts ,sact[1].action) or target:HasOneOfTags({"structure", "_equippable", "lureplant", "bundle"})) then
                sact[1]._lock_huxi_dont_toss = true
                return sact
            end
        end
        return actions
    end

    local OldOnRightClick = PlayerController.OnRightClick
    function PlayerController:OnRightClick(down, ...)
        if not down then
            return OldOnRightClick(self, down, ...)
        end
        local act = self:GetRightMouseAction()
        if act and act._lock_huxi_dont_toss then
            local equip = GetEquippedItemFrom("hands")
            if equip:HasTag("dumbbell") then
                GLOBAL.ThePlayer.replica.inventory:ControllerUseItemOnSelfFromInvTile(equip)
            end
        end
        return OldOnRightClick(self, down, ...)
    end

end


local function OnWorldPostInit(inst)
    inst:ListenForEvent("playeractivated", OnPlayerActivated, GLOBAL.TheWorld)
end
AddPrefabPostInit("world", OnWorldPostInit)